home *** CD-ROM | disk | FTP | other *** search
- Path: li.net!usenet
- From: bsilvern@li.net (Bob Silvern)
- Newsgroups: comp.lang.c++
- Subject: Re: BORLAND C++ 4.5 wont add .1 and .9
- Date: Thu, 25 Jan 1996 17:22:03 GMT
- Organization: Harmony Graphics
- Message-ID: <4e8e80$jdc@linet02.li.net>
- References: <corekinDLG8t4.3C5@netcom.com> <4e5njv$e9v@damon.irf.uni-dortmund.de>
- NNTP-Posting-Host: lisuser44.li.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- rothert@damon.irf.uni-dortmund.de (Bernd Rothert) wrote:
-
- >In article <corekinDLG8t4.3C5@netcom.com>,
- > corekin@netcom.com (david corekin) wrote:
- >>I had some problems with floating point numbers as well. In my
-
- >Today I discovered that my BC++ 4.5 doesn't even add 1+1 correctly - try:
-
- >#include <stdio.h>
- >int one(void) { return 1; }
- >int main(void)
- >{
- > int zero = 0;
- > int two = (zero == 0) ? one()+1 : zero+1;
- > printf("one() plus 1 is %d\n", two);
- > return 0;
- >}
-
- >After compiling with "bcc -ml bug21.c" (BC++ version 4.5) the program outputs:
- > one() plus 1 is 1
- >which is not exactly what I whould expect...
-
- >Bernd
-
- If seen some pretty bad Borland bugs, but nothing this bad. FYI, I tried the
- above code on Borland 4.02 and it worked correctly. I'm curious what the
- problem really is. Is it a problem with the ? operator within the definition
- of the variable "two"? Is it calling the function one() from within the
- definition of "two". Is it a printf bug? None of these seems likely. Perhaps
- you could try simplifying this example to determine the preicise cause of the
- error.
-
-
-